// wglquark.hpp
//

#ifndef _WGLQUARK_HPP
#define _WGLQUARK_HPP

#include "wgl/wglbase.hpp"

namespace wgl
{
  // Quark
  //
  class Quark
  {
  public:
    using QType = uint32_t;

    Quark () = delete;
    Quark ( const std::string &s );
    Quark ( Quark &other ) { value_ = other.value_; }
    Quark ( Quark && ) = delete;

    Quark &operator= ( const Quark &other ) { value_ = other.value_; return *this; }
    bool operator== ( const Quark &other ) const { return value_ == other.value_; }

    QType value () const { return value_; }
    const std::string &name () const;

  private:
    static QType value_counter;
    static std::unordered_map<std::string, QType> quarks_by_name;
    static std::unordered_map<QType, const std::string &> quarks_by_id;

    QType value_;
  };

  inline Quark::QType Quark::value_counter{0};
  inline std::unordered_map<std::string, Quark::QType> Quark::quarks_by_name{};
  inline std::unordered_map<Quark::QType, const std::string &> Quark::quarks_by_id{};
}

#endif
